package io.github.uicdb.et.client;


import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.minecraft.Util;
import net.minecraft.client.renderer.RenderStateShard;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.resources.ResourceLocation;

import java.util.function.Function;

public class SimpleRenderType extends RenderType {

    public static final Function<ResourceLocation, RenderType> IMAGE = Util.memoize((resourceLocation) -> {
        CompositeState compositeRenderType = CompositeState.builder()
                .setShaderState(RENDERTYPE_ARMOR_ENTITY_GLINT_SHADER)
                .setTextureState(new RenderStateShard.TextureStateShard(resourceLocation, true, false))
                .setWriteMaskState(RenderStateShard.COLOR_DEPTH_WRITE)
                .setCullState(NO_CULL)
                .setDepthTestState(RenderStateShard.LEQUAL_DEPTH_TEST)
                .setTransparencyState(RenderStateShard.NO_TRANSPARENCY)
                .setTexturingState(RenderStateShard.DEFAULT_TEXTURING)
                .setLayeringState(RenderStateShard.NO_LAYERING)
                .createCompositeState(false);
        return create("world_image", DefaultVertexFormat.POSITION_TEX, VertexFormat.Mode.QUADS, 1024, false, true, compositeRenderType);
    });

    public SimpleRenderType(String pName, VertexFormat pFormat, VertexFormat.Mode pMode, int pBufferSize, boolean pAffectsCrumbling, boolean pSortOnUpload, Runnable pSetupState, Runnable pClearState) {
        super(pName, pFormat, pMode, pBufferSize, pAffectsCrumbling, pSortOnUpload, pSetupState, pClearState);
    }
}
